/*****************************************************************************//*!
* file  : test.c
* creat : apleilx
* data  : 2017/03/02
*******************************************************************************/
#define   __os_obj_creat__                                        // define objects in rtxapp module
#include "os_obj.h"                                          // RTOS object definitions
#include "pincfg.h"

void SysTask (void   *argument);
void UsbTask(void  *argument);
void modbus_task (void  *argument);
void led_ctr(void  *argument);
void FlashTask(void  *argument);


/*----------------------------------------------------------------------------
 *      systask , create befor os start
 *---------------------------------------------------------------------------*/
int thread_init (void)
{
    rt_thread_init(
        &os_obj.tid_sys_task,
        "sys task",
        SysTask,
        "argv",
        os_obj.stk_sys_task,
        1024*4,
        5,
        10
    );
    
    rt_thread_startup(&os_obj.tid_sys_task);
    
    return(0);
}


/*----------------------------------------------------------------------------
 *   created in systask
 *---------------------------------------------------------------------------*/
int os_obj_init (void)
{

    os_obj.eid_mb = rt_event_create("mb event", RT_IPC_FLAG_FIFO);
  
    os_obj.tid_mbTask = rt_thread_create(
        "mb task",
        modbus_task,
        "argv",
        1024*4,
        20,
        10
    );
    
    
    
    rt_thread_startup(os_obj.tid_mbTask);
    
    return(0);
}


